﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>条码记录</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link href="~/Content/X-admin/css/font.css" rel="stylesheet" />
    <script src="~/Content/X-admin/lib/layui/layui.js"></script>
    <link href="~/Content/X-admin/css/xadmin.css" rel="stylesheet" />
    <script src="~/Content/X-admin/js/jquery.min.js"></script>
    <script src="~/Content/X-admin/js/xadmin.js"></script>
    <script src="~/Content/Scripts/System/systemFrame.js"></script>
    <script src="~/Content/Scripts/System/Common.js"></script>
</head>
<body>
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">

                    <form class="layui-form layui-col-space5" name="qForm" id="qForm">
                        <input type="hidden" name="proCode" id="proCode" />
                        <input type="hidden" name="t.tempCode" id="t.tempCode" />
                        <input type="hidden" name="b.spec" id="b.spec" />
                        <input type="hidden" name="b.c_xilie" id="b.c_xilie" />
                        <input type="hidden" name="b.outCompanyName" id="b.outCompanyName" />
                    </form>
                    <div class="layui-card-body layui-table-body layui-table-main">
                        <table class="layui-hide" id="list" lay-filter="list"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>

</html>
<script type="text/html" id="barDemo">
    <a title="删除" href="javascript:;" lay-event="del"><i class="layui-icon">&#xe640;</i></a>
</script>
<script>

    function loadData() {
        layui.use('table', function () {

            var conditon = JSON.stringify(FormToJson("qForm"));
            var table = layui.table;
            table.render({
                elem: '#list'
            , cols: [[ //标题栏
              { field: 'id', title: 'ID', width: 80 }
            , { field: 'barCode', title: '条码', width: 130 }
            , { field: 'proCode', title: '存货编码', width: 110, }
            , { field: 'c_customer', title: '客户名称', width: 130, }
            , { field: 'proName', title: '存货名称', width: 150 }
            , { field: 'spec', title: '规格型号', width: 130 }
            , { field: 'c_mishu', title: '单卷米数', width: 100 }
            , { field: 'c_gongjin', title: '公斤数', width: 100 }
            , { field: 'relationBar', title: '关联条码', width: 120 }
            , { field: 'pusers', title: '生产人员', width: 120 }
            , { field: 'createtime', title: '扫码时间', width: 150 }
            , { field: 'right', title: '操作', toolbar: '#barDemo', width: 90, fixed: 'right' }
            ]], done: function (res, curr, count) {
                $("[data-field='id']").css('display', 'none');//隐藏列
            }
            , url: "../Bar/GetDataList?dataType=tbsd&condition=" + conditon
            , skin: 'row' //表格风格
            , even: true
            , page: false //是否显示分页
            , limits: [30, 45, 60]
            , limit: 30 //每页默认显示的数量
            });
            //监听工具条
            table.on('tool(list)', function (obj) {
                var data = obj.data;
                if (obj.event == 'del') {
                    $.ajax({
                        url: "../Bar/DelTempScan",
                        data: { dataId: data.id },
                        type: "post",
                        success: function (data) {
                            if (data.Result) {
                                obj.del();
                            } else {
                                layer.msg(data.Message);
                            }
                        }
                    });

                }


            });
        });

    }
    $(function () {
        var tempCode = getUrlVariable("tempCode");
        var proCode = getUrlVariable("proCode");
        var spec = getUrlVariable("spec");
        $("input[ name='b.proCode']").val(proCode);
        $("input[ name='b.spec']").val(spec);
        $("input[ name='t.tempCode']").val(tempCode);
        $("input[ name='b.c_xilie']").val(getUrlVariable("xilie"));
        $("input[ name='b.outCompanyName']").val(decodeURI(getUrlVariable("companyName")));
        loadData();
    })

</script>